package com.example.gametouch;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;



public class Player extends Activity {
	private Spinner dk;
	private ArrayAdapter ad;
	private EditText name; 
	int dokho;
	String ten;
	private String[] array={"DỄ","BÌNH THƯỜNG","KHÓ"};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.player);
		dk=(Spinner)findViewById(R.id.dsdk);
		name=(EditText)findViewById(R.id.name);
		ad=new ArrayAdapter<String>(Player.this, android.R.layout.simple_spinner_item, array);
ad.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
dk.setAdapter(ad);
dk.setOnItemSelectedListener(new OnItemSelectedListener() {

	@Override
	public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
			long arg3) {
		// 
		switch (arg2) {
		case 0:
			 dokho=1000;
			 break;
		case 1: dokho=800;
		break;
		case 2:dokho=500;
			break;

		default:
			break;
		}
		
	}

	@Override
	public void onNothingSelected(AdapterView<?> arg0) {
		// TODO Auto-generated method stub
		
	}
});

	}
	public void start(View view ){
		ten=name.getText().toString();
		boolean co = false;
		int biendem = 30000;
		Intent player = new Intent(Player.this, NewGame.class);
		Bundle bd = new Bundle();
		bd.putString("NAME", ten);
		bd.putInt("DOKHO", dokho);
		bd.putInt("BIENDEM", biendem);
		bd.putBoolean("CO", co);
		player.putExtras(bd);
		startActivity(player);
		
	}
		
	

}

